package ano.it.jobs;

import ano.it.dao.GreenHouseDao;
import ano.it.pojo.DetailedData;
import ano.it.service.GreenHouseService;
import ano.it.service.impl.GreenHouseServiceImpl;
import ano.it.utils.DownFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;
@Transactional
public  class DocumentDetailsJobs {
    @Autowired
    private GreenHouseDao greenHouseDao;

    public  void DocumentDetails(){
        DetailedData detailedData=new DetailedData();
        List<Map<String, String>> mapList = DownFile.xiazai();
        for (Map<String, String> result:mapList){
            //取出返回结果数据，准备将报表数据写入到Excel文件中
            String id = (String) result.get("id");
            String crop= (String) result.get("crop");
            String crop_num = (String) result.get("crop_num");
            String grow = (String) result.get("grow");
            String room_wendu = (String) result.get("room_wendu");
            String kong_shidu = (String) result.get("kong_shidu");
            String tu_shi = (String) result.get("tu_shi");
            String ph = (String) result.get("ph");
            String co2 = (String) result.get("co2");
            String sun = (String) result.get("sun");
            String kong_zhi = (String) result.get("kong_zhi");
            String buguang = (String) result.get("buguang");
            String shexiang = (String) result.get("shexiang");
            String jiaoguan = (String) result.get("jiaoguan");
            String chuangru = (String) result.get("chuangru");
            String huanjing = (String) result.get("huanjing");
            String fuzeren = (String) result.get("fuzeren");
            detailedData = new DetailedData(id,crop_num,grow,room_wendu,kong_shidu,tu_shi,ph,co2,sun,kong_zhi,buguang,shexiang,jiaoguan,chuangru,huanjing,crop,fuzeren);
            greenHouseDao.adddetail(detailedData);
        }

        System.out.println("定时任务");

    }
}
